package JavaTest.constructor;

public class Constructor01 {
    public static void main(String[] args) {
        //当我们new一个person对象时，通过构造器初始化name和age
        Person person = new Person("a",1);
    }

}
class Person{
    String name;
    int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    //只指定人名。不指定年龄
    public Person(String name) {
        this.name = name;
    }

}
